<template>
  <div>
    <div v-for="(forms, index) in stoveReport" :key="forms._id">
      <div class="stovecard">
        <div class="head">
          <span class="head-left"></span>
          <div class="head-number">
            {{
              stoveReport.length === 1 ? "装炉" : stoveNumber[index] + "炉装炉"
            }}
          </div>
        </div>
        <div class="tunnel-table">
          <table style="width: 100%">
            <tr class="item">
              <td>加工单位</td>
              <td>种类/规格</td>
              <td>数量</td>
              <td>长度</td>
              <td>单重</td>
              <td>重量</td>
            </tr>
            <tr v-for="item in forms.stove.stoveReport || []" :key="item._id">
              <td>{{ item.processUnit }}</td>
              <td>{{ item.type }}/{{ item.specification }}</td>
              <td>{{ item.number == 0 ? "" : item.number }}</td>
              <td>{{ item.length == 0 ? "" : item.length }}</td>
              <td>{{ item.singleWeight == 0 ? "" : item.singleWeight }}</td>
              <td>{{ item.weight == 0 ? "" : item.weight }}</td>
            </tr>
          </table>
        </div>
      </div>
      <div class="stovecard">
        <div class="head">
          <span class="head-left"></span>
          <div class="head-number">
            {{
              stoveReport.length === 1 ? "送电" : stoveNumber[index] + "炉送电"
            }}
          </div>
          <div class="head-right">
            {{ forms.stove.stoveTime }} / {{ forms.stove.totalNumber }}支 /
            {{ forms.stove.totalWeight }}吨
          </div>
        </div>
        <div class="tunnel-table">
          <table style="width: 100%">
            <tr class="item">
              <td colspan="2">总第炉数</td>
              <td colspan="2">送电开始功率</td>
              <td colspan="2">计划电量</td>
              <td colspan="2">计划电量</td>
            </tr>
            <tr class="table_value">
              <td colspan="2">{{ forms.stove.electric.totalStoveNum }}</td>
              <td colspan="2">{{ forms.stove.electric.startPower }}</td>
              <td colspan="2">{{ forms.stove.electric.plannedElectricity }}</td>
              <td colspan="2">{{ forms.stove.electric.plannedElectricity }}</td>
            </tr>
            <tr class="table_key">
              <td colspan="2">装炉柱数</td>
              <td colspan="2">单柱串接</td>
              <td colspan="2">截面</td>
              <td colspan="2">电密</td>
            </tr>
            <tr class="table_value">
              <td colspan="2">{{ forms.stove.electric.stoveColumnNum }}</td>
              <td colspan="2">{{ forms.stove.electric.oneColumnStrand }}</td>
              <td colspan="2">{{ forms.stove.electric.section }}</td>
              <td colspan="2">{{ forms.stove.electric.denseElectricity }}</td>
            </tr>
            <tr class="table_key">
              <td colspan="2">位移要求</td>
              <td colspan="2">配重</td>
              <td colspan="2">保温料</td>
              <td colspan="2">装炉方式</td>
            </tr>
            <tr class="table_value">
              <td colspan="2">{{ forms.stove.electric.displacementLess }}</td>
              <td colspan="2">{{ forms.stove.electric.counterweight }}</td>
              <td colspan="2">{{ forms.stove.electric.keepWarmMaterial }}</td>
              <td colspan="2">{{ forms.stove.electric.stoveWay }}</td>
            </tr>
          </table>
        </div>
      </div>
      <div class="placeholder" v-if="stoveReport.length === 2"></div>
      <div class="stovecard">
        <div class="head">
          <span class="head-left"></span>
          <div class="head-number">
            {{
              stoveReport.length === 1
                ? "送电曲线"
                : stoveNumber[index] + "炉送电曲线"
            }}
          </div>
        </div>
        <div class="tunnel-table">
          <table style="width: 100%">
            <tr class="item">
              <td>时间</td>
              <td colspan="7">功率（KW）</td>
            </tr>
            <tr class="table_value" v-for="item in 4" :key="item">
              <td colspan="2">
                {{ (item - 1) * 6 }}-{{ (item - 1) * 6 + 6 }}h
              </td>
              <td>
                {{ forms.stove.electric.powerTime[0 + (item - 1) * 6].power }}
              </td>
              <td>
                {{ forms.stove.electric.powerTime[1 + (item - 1) * 6].power }}
              </td>
              <td>
                {{ forms.stove.electric.powerTime[2 + (item - 1) * 6].power }}
              </td>
              <td>
                {{ forms.stove.electric.powerTime[3 + (item - 1) * 6].power }}
              </td>
              <td>
                {{ forms.stove.electric.powerTime[4 + (item - 1) * 6].power }}
              </td>
              <td>
                {{ forms.stove.electric.powerTime[5 + (item - 1) * 6].power }}
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="placeholder3"></div>
      <div class="stovecard">
        <div class="head">
          <span class="head-left"></span>
          <div class="head-number">
            {{
              stoveReport.length === 1 ? "停电" : stoveNumber[index] + "炉停电"
            }}
          </div>
        </div>
        <div class="tunnel-table">
          <table style="width: 100%">
            <tr class="item">
              <td colspan="2">直流电压</td>
              <td colspan="2">直流电流</td>
              <td colspan="2">起始炉阻</td>
              <td colspan="2">停电功率</td>
              <td colspan="2">停炉炉阻</td>
              <td colspan="2">吨耗</td>
            </tr>
            <tr class="table_value">
              <td colspan="2">
                {{
                  forms.stove.electric.voltage == 0
                    ? ""
                    : forms.stove.electric.voltage
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.electricCurrent == 0
                    ? ""
                    : forms.stove.electric.electricCurrent
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.startStoveResistance == 0
                    ? ""
                    : forms.stove.electric.startStoveResistance
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.stopPower == 0
                    ? ""
                    : forms.stove.electric.stopPower
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.stopStoveResistance == 0
                    ? ""
                    : forms.stove.electric.stopStoveResistance
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.tonConsumption == 0
                    ? ""
                    : forms.stove.electric.tonConsumption
                }}
              </td>
            </tr>
            <tr class="talbe_key">
              <td colspan="2">实际电量</td>
              <td colspan="2">尖峰</td>
              <td colspan="2">高峰</td>
              <td colspan="2">平段</td>
              <td colspan="2">谷电</td>
              <td colspan="2">总价位</td>
            </tr>
            <tr class="table_value">
              <td colspan="2">
                {{
                  forms.stove.electric.actualElectricity == 0
                    ? ""
                    : forms.stove.electric.actualElectricity
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.specialPowerTime[0].power == 0
                    ? ""
                    : forms.stove.electric.specialPowerTime[0].power
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.specialPowerTime[1].power == 0
                    ? ""
                    : forms.stove.electric.specialPowerTime[1].power
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.specialPowerTime[3].power == 0
                    ? ""
                    : forms.stove.electric.specialPowerTime[3].power
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.specialPowerTime[2].power == 0
                    ? ""
                    : forms.stove.electric.specialPowerTime[2].power
                }}
              </td>
              <td colspan="2">
                {{
                  forms.stove.electric.totalPrice == 0
                    ? ""
                    : forms.stove.electric.totalPrice
                }}
              </td>
            </tr>
          </table>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getReportStoveData } from "@/api/process";
export default {
  props: ["startTime", "endTime"],
  data() {
    return {
      stoveNumber: ["A", "B", "C"],
      stoveReport: [],
    };
  },
  mounted() {
    this.GetReportStoveByTime();
  },
  methods: {
    async GetReportStoveByTime() {
      const params = {
        startTime: this.startTime,
        endTime: this.endTime,
      };
      const res = await getReportStoveData(params);
      // console.log(res.data.data)
      if (res.data.code === 200) {
        this.stoveReport = res.data.data.pageData || [];
      }
      if (!res.data.data.pageData) {
        this.$emit("showStove", false);
      }
    },
  },
};
</script>

